package myky.com.doctorapp.model;

import java.util.HashMap;
import java.util.Map;

import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import myky.com.doctorapp.api.ApiManager;
import myky.com.doctorapp.entity.LoginSuccessEntity;
import myky.com.doctorapp.entity.SmsCodeEntity;
import myky.com.doctorapp.base.BaseEntity;
import myky.com.doctorapp.contract.PnLoginFragmentContract;

/**
 * Description:
 *
 * @author Mr.li
 * Ctreated by 2018/12/13 17:38
 */
public class PnLoginFragmentModel implements PnLoginFragmentContract.Model {

    @Override
    public Observable<BaseEntity<LoginSuccessEntity.PayLoadBean>> quickLogin() {
        return  ApiManager.getApistore().quickLogin().subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread());
    }

    @Override
    public Observable<BaseEntity<SmsCodeEntity.PayloadBean>> getSmsCode(String mobile, String opt) {
        Map<String,String> stringMap = new HashMap<>(16);
        stringMap.put("mobile", mobile);
        stringMap.put("opt", opt);
        return ApiManager.getApistore().getSmsCode(stringMap).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread());
    }
}
